package com.bbs.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/***
 * 
 *
 */
public class SelectServlet extends HttpServlet
{

	private static final long serialVersionUID = 1L;

	public SelectServlet()
	{
		super();
	}

	public void destroy()
	{
		super.destroy();
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
//		response.setCharacterEncoding("GBK");
		response.setContentType("text/xml");
		response.setHeader("Cache-Control", "no-cache");
		request.setCharacterEncoding("GBK");
		response.setCharacterEncoding("UTF-8");
		String targetId = request.getParameter("id").toString();
		System.out.println(targetId);
		// ��������в���Ϊid��ֵ
		String xml_start = "<selects>";
		String xml_end = "</selects>";
		String xml = "";

		if (targetId.equalsIgnoreCase("0"))
		{
			xml = "<select><value>0</value><text>��ѡ��</text></select>";
		} else if (targetId.equalsIgnoreCase("1"))
		{
			xml = "<select><value>1</value><text>��ƽ</text></select>";
			xml += "<select><value>2</value><text>��̨</text></select>";
			xml += "<select><value>3</value><text>����</text></select>";
			xml += "<select><value>4</value><text>����</text></select>";
		} else if (targetId.equalsIgnoreCase("2"))
		{
			xml = "<select><value>1</value><text>������</text></select>";
			xml += "<select><value>2</value><text>������</text></select>";
			xml += "<select><value>3</value><text>�����</text></select>";
			xml += "<select><value>4</value><text>������</text></select>";
		} else
		{// �����3,�򷵻�������ַ�
			xml = "<select><value>1</value><text>����</text></select>";
			xml += "<select><value>2</value><text>�ൺ</text></select>";
			xml += "<select><value>3</value><text>�Ͳ�</text></select>";
			xml += "<select><value>4</value><text>��ׯ</text></select>";
		}

		String last_xml = xml_start + xml + xml_end;
		response.getWriter().write(last_xml);

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		doGet(request, response);
	}

	public void init() throws ServletException
	{
	}

}
